/*
 * TabbedPane.hpp
 *
 *  Created on: 12-12-2010
 *      Author: Przemek
 */

#pragma once

#include "Container.hpp"
#include "pch.hpp"

class TabbedPane: public Container
{
	private:
		class Tab
		{
			private:
				std::string name;
				Control* control;

			public:
				Tab(const std::string& name, Control* control);

				const std::string& getName() const;
				Control* getControl() const;

		};
		static const float TABS_HEIGHT;
		static const float TABS_OFFSET;
		std::vector<Tab> tabs;
		int currentTabIndex;

	public:
		TabbedPane();
		void add(Control* control, const std::string& name);
		virtual void setBounds(const geometry::Rectangle& bounds);
		virtual void setSize(const Dimension& size);
		Control* getDeepestControlAt(const Vector& point, Vector* pointInControlCoordinates);

		void draw(const ClipArea& clipArea);

	private:
		void add(Control* control);
		void updateAllTabsBounds();
		void setNewTabBounds(Control* control);
		void drawSingleTab(unsigned int i);
		geometry::Rectangle getBoundsForTab(unsigned int i);

		void mousePressed(const MouseListener::EventArguments& arguments);
};
